# build
FROM node:10.15.3-alpine AS builder
WORKDIR /tmp/app
COPY ./package.json /tmp/app/package.json
RUN npm i node-sass --sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
RUN npm install chromedriver --chromedriver_cdnurl=http://cdn.npm.taobao.org/dist/chromedriver
RUN npm install --registry=https://registry.npm.taobao.org
ARG BUILD_ENV=__VUILD_ENV__
COPY . /tmp/app
RUN npm run build-test

# nginx
FROM nginx:alpine
WORKDIR /usr/share/nginx/html
COPY ./default.conf /etc/nginx/conf.d/
COPY --from=builder /tmp/app/dist /usr/share/nginx/html/
EXPOSE 80
